package dao;

import dao.oracle.OracleDaoFactory;

/**
 * Abstract DAO factory class
 * @author Ilya_Poliakov
 */
public abstract class DaoFactory {
	/**
	 * Oracle DAO type ID
	 */
	public static final int ORACLE = 1;
	private static OracleDaoFactory oracleDaoFactory;

	/**
	 * Create and return new DAO factory of specified type
	 * @param whichFactory DAO factory ID
	 * @return new DAO factory of specified type
	 */
	public static DaoFactory getDaoFactory(int whichFactory) {
		switch (whichFactory) {
		case ORACLE:
			return (oracleDaoFactory != null ? oracleDaoFactory
					: (oracleDaoFactory = new OracleDaoFactory()));
		default:
			return null;
		}
	}

	/**
	 * return Bid DAO object
	 * @return Bid DAO object
	 */
	public abstract BidDao getBidDao();

	/**
	 * return FullInfo Dao object
	 * @return FullInfo Dao object
	 */
	public abstract FullInfoDao getFullInfoDao();

	/**
	 * return Item DAO object
	 * @return Item DAO object
	 */
	public abstract ItemDao getItemDao();

	/**
	 * return User DAO object
	 * @return User DAO object
	 */
	public abstract UserDao getUserDao();
}
